package com.coin900.coin.service.coin;

import com.coin900.coin.persist.coin.CoinProjectCoinVO;
import com.coin900.coin.persist.coin.CoinVirtualCoinVO;
import com.value.mybatis.IDaoRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CoinProjectCoinService implements ICoinProjectCoinService {

    @Override
    public List<CoinProjectCoinVO> loadCoinProjectCoin(Map<String, Object> params) {
        return this.daoRouter.query("CoinProjectCoin.loadCoinProjectCoin", params);
    }

    @Override
    public void insertCoinProjectCoin(CoinProjectCoinVO coinProjectCoinVO) {
        this.daoRouter.insert("CoinProjectCoin.insertCoinProjectCoin", coinProjectCoinVO);
    }

    @Override
    public void insertCoinProjectCoinBatch(Long projectId, List<CoinProjectCoinVO> coinProjectCoinList) {
        for (CoinProjectCoinVO coinProjectCoinVO : coinProjectCoinList) {
            coinProjectCoinVO.setProjectId(projectId);
            this.daoRouter.insert("CoinProjectCoin.insertCoinProjectCoin", coinProjectCoinVO);
        }
    }

    @Override
    public void updateCoinProjectCoin(CoinProjectCoinVO coinProjectCoinVO) {
        this.daoRouter.update("CoinProjectCoin.updateCoinProjectCoin", coinProjectCoinVO);
    }

    @Override
    public void deleteCoinProjectCoin(CoinProjectCoinVO coinProjectCoinVO) {
        this.daoRouter.update("CoinProjectCoin.deleteCoinProjectCoin", coinProjectCoinVO);
    }

    @Autowired
    private IDaoRouter daoRouter;

}